<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('web_visit', function (Blueprint $table) {
            $table->id();
            $table->string('url', 1000)->default('')->comment('访问地址');
            $table->string('country', 50)->default('')->comment('国家');
            $table->string('province', 50)->default('')->comment('省');
            $table->string('city', 50)->default('')->comment('市');
            $table->string('district', 50)->default('')->comment('区/县');
            $table->string('ip', 50)->default('')->comment('IP');
            $table->string('session_id', 50)->default('')->comment('session_id');
            $table->string('platform', 50)->default('')->comment('平台');
            $table->string('referrer', 50)->default('')->comment('访问方式');
            $table->string('browser', 50)->default('')->comment('浏览器');
            $table->string('user_agent', 500)->default('')->comment('userAgent');
            $table->string('language', 20)->default('')->comment('客户端语言');
            $table->tinyInteger('is_robot')->default(0)->comment('机器人:0=否,1=是');
            $table->tinyInteger('create_hour')->default(0)->comment('小时');
            $table->date('create_date')->comment('日期');
            $table->integer('created_at')->default(0)->comment('创建时间');
        });
        DB::statement("ALTER TABLE `web_visit` comment '【网站】访问日志'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('web_visit');
    }
};
